package com.rui.study.algorithm.T_模运算与与运算;

import com.rui.study.algorithm.PrintUtil;

import java.util.Random;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2018-11-13 09:54
 **/
public class Main {

    static Random r = new Random(System.currentTimeMillis());

    public static void test1() {
        int num = r.nextInt(50);
        int val1 = num % 8;
        int val2 = num & (8 - 1);
        PrintUtil.print(num + " % 8 = " + val1);
        PrintUtil.print(num + " & (8 - 1) = " + val2);
        PrintUtil.print("");
    }

    public static void main(String[] args) {
        for (int i=0; i<100; i++) {
            test1();
        }
    }
}
